package com.ruoyi.system.designpattern.visitor;

// 具体访问者：清点库存
public class InventoryVisitor implements Visitor {
    
    @Override
    public void visit(Book book) {
        System.out.printf("Book: %s, Stock: %d%n", book.getName(), book.getStock());
    }
    
    @Override
    public void visit(CD cd) {
        System.out.printf("CD: %s, Stock: %d%n", cd.getName(), cd.getStock());
    }
    
    @Override
    public void visit(DVD dvd) {
        System.out.printf("DVD: %s, Stock: %d%n", dvd.getName(), dvd.getStock());
    }
}
